<?php
session_start();
include "Includes/solotrn_sesion.php";
include "Includes/soloFun_Generales.php";

//'===============================================================================================================================================
//'carga el combo de tecnicos:
//'*****************************
$CboSoporte = $_REQUEST["CboSoporte"];
$soloSQL2 = "select * from tb_soporte";
$err = 0;
soloFun_ExecSQL ($soloSQL2,$SoloArrSoporte);
$StrCboSoporte = SoloFun_CargaCombo($SoloArrSoporte,"CboSoporte","",$CboSoporte," style='width: 180' class='SoloStyle_Texto'","TODOS");
//'===============================================================================================================================================
//'Public nodo
//'Public CboNodo
//'CboNodo=$_REQUEST["CboNodo")
//''''''''''''''TopNodo = ObtenerPrimerNodosql
if ($CboSoporte == "")
    $strsql = "select * from solotb_asociar_categ_tecnico";
else
    $strsql = "select * from solotb_asociar_categ_tecnico where cod_tecnico like'". $CboSoporte ."'";

SoloFun_ExecSql ($strsql, $SoloArrcateg);
//dim nivel1(20), nivel2(20), nivel3(20), nivel4(20), nivel5(20)
$nivel1 = array();
$nivel2 = array();
$nivel3 = array();
$nivel4 = array();
$nivel5 = array();

for ($i = 0; $i < count($SoloArrcateg); $i++) {
    $sql = "select des from solotb_nivel1 where id1=". $SoloArrcateg[$i][2];
    $nivel1[$i] = EjecutaSentenciaSql($sql);
    $sql = "select des from solotb_nivel2 where id2=". $SoloArrcateg[$i][3];
    $nivel2[$i] = EjecutaSentenciaSql($sql);
    $sql = "select des from solotb_nivel3 where id3=". $SoloArrcateg[$i][4];
    $nivel3[$i] = EjecutaSentenciaSql($sql);
    $sql = "select des from solotb_nivel4 where id4=". $SoloArrcateg[$i][5];
    $nivel4[$i] = EjecutaSentenciaSql($sql);
    $sql = "select des from solotb_nivel5 where id5=". $SoloArrcateg[$i][6];
    $nivel5[$i] = EjecutaSentenciaSql($sql);
}
switch ($opcion) {
    case 1: $boton = "<input type='submit' name='CmdGrabar' value='Modificar'>";
        $Titulo = "Modificar M&oacute;dulos";
        $Oculto = "<input type='hidden' name='Opcion' value=1 class='boton'>";
        $pagina = "solotrn_GrabarModulo.php?Opcion=1&CboNodo=$CboNodo&";
        break;
    case 2: $boton = "<input type='submit' name='CmdGrabar' value='Eliminar'>";
        $Titulo = "Eliminar M&oacute;dulos";
        $Oculto = "<input type='hidden' name='Opcion' value=2 class='boton'>";
        $pagina = "solotrn_GrabarModulo.php?Opcion=2&CboNodo=$CboNodo&";
        break;
    case 3: $boton = "<input type='submit' name='CmdGrabar' value='Crear'>";
        $Titulo = "Ingresar M&oacute;dulos";
        $Oculto = "<input type='hidden' name='Opcion' value=3 class='boton'>";
        $pagina = "solotrn_GrabarModulo.php?Opcion=3&CboNodo=$CboNodo&";
        break;
    case 0: $boton = "";
        $Titulo = "Administrar M&oacute;dulos";
        $Oculto = "<input type='hidden' name='Opcion' value=0>";
}
?>

<html>
    <head>
        <title>SoloPortal</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <link rel="stylesheet" href="SoloStyles/Solostyles.css" type="text/css">
        <SCRIPT type="text/JavaScript" src="Includes/Solofun_generales.js"></SCRIPT>
    </head>
    <body topmargin="0" leftmargin="0" onkeydown="checkKey();">


        <p align="center" class="SoloStyle_TituloPaginas">Asociar Categor&iacute;as con Responsables</p>
        <form name="frm" action="solotrn_ConsultarCategorias.php" method="POST">
<?php echo $Oculto;?>

            <table border="0" width="80%" align="center">
                <tr>
                    <td>

                        <table width="100%" align="left">
                            <tr>
                                <td><img src="iconos/soloico_nuevo.gif" border="1" alt="Asociar nueva categoria" style="cursor:hand" onClick="SoloWindows('solotrn_asociar_tecnico_categoria.php?opc1=3',200,200,600,350);" > <img src="iconos/soloico_buscar.gif" border="1" alt="Buscar" style="cursor:hand" onClick="document.frm.submit();"></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table border="1" width="100%" cellpadding="2" cellspacing="1" bordercolor="#CCCCCC" align="left">
                            <tr>
                                <td width="30%" class="SoloStyle_Etiqueta">Responsable</td>
                                <td width="70%" class="SoloStyle_EtiquetaCajas"><span class="SoloStyle_Grid"><?php echo $StrCboSoporte;?></span></td>
                            </tr>
                        </table>

                    </td>
                </tr>
            </table>

        </form>
<?php  if ($CboSoporte == "") { ?>
        <table width="90%" border="1" cellpadding="0" cellspacing="1" align="center" bordercolor="#CCCCCC">
            <tr class="SoloStyle_Etiqueta">
                <td width="6.75%" class="texto">T&eacute;cnico</td>
                <td width="13.5%" class="texto">Subsecretar&iacute;a</td>
                <!--<td width="13.5%" class="texto">Departamento</td>
                <td width="13.5%" class="texto">Categor&iacute;a</td>-->
                <td width="13.5%" class="texto">Tr&aacute;mite</td>
                <!--<td width="13.5%">Categor&iacute;a3</td>-->
                <td width="6.75%" class="texto">Tiempo de expiraci&oacute;n</td>
                <td width="13.5%" class="texto">Acci&oacute;n</td>
            </tr>
                <?php
//		'CL_FILAS=-1
//		'CL_FILAS=ubound(arrUsuario,2)
//   'IF CL_FILAS>=0 THEN
    $cantidad = 0;
    for ($i = 0; $i < count($SoloArrcateg); $i++) {
        $clase = "SoloStyle_texto";
        if ($i%2 ==0) $clase = "SoloStyle_Grid";?>
            <tr class="<?php echo $clase;?>">
                <td width="6.75"><?php echo $SoloArrcateg[$i][1];?></td>
                <td width="13.5%"><?php echo $nivel1[$i];?></td>
                <!--<td width="13.5%"><?php echo $nivel2[$i];?></td>
                <td width="13.5%"><?php echo $nivel3[$i];?></td>-->
                <td width="13.5%"><?php echo $nivel4[$i];?> </td>
                <!--<td width="13.5%"><?php echo $nivel5[$i];?> </td>-->
                        <?php
                        if ($SoloArrcateg[$i][9] == 63 && $SoloArrcateg[$i][10] == 1)
                            $tiempo = "D&iacute;a";
                        elseif ($SoloArrcateg[$i][9] == 63 && $SoloArrcateg[$i][10] > 1)
                            $tiempo = "D&iacute;as";
                        elseif ($SoloArrcateg[$i][9] == 64 && $SoloArrcateg[$i][10] == 1)
                            $tiempo = "Hora";
                        elseif ($SoloArrcateg[$i][9] == 64 && $SoloArrcateg[$i][10] > 1)
                            $tiempo = "Horas";
                        elseif ($SoloArrcateg[$i][9] == 65 && $SoloArrcateg[$i][10] == 1)
                            $tiempo = "Minuto";
                        elseif ($SoloArrcateg[$i][9] == 65 && $SoloArrcateg[$i][10] > 1)
                            $tiempo = "Minutos";
                        /*end if
	end if
	end if
	end if
	end if
	end if*/
        ?>

                <td width="6.75%"><?php echo $SoloArrcateg[$i][10];?>&nbsp;<?php echo $tiempo;?></td>
                <td width="13.5%">
                    <!--&nbsp;<a href="javascript:SoloFun_Windows('solotrn_asociar_tecnico_categoria.php?empresa=<?php echo $SoloArrcateg[$i][2];?>&departamento=<?php echo $SoloArrcateg[$i][3];?>&cat1=<?php echo $SoloArrcateg[$i][4];?>&cat2=<?php echo $SoloArrcateg[$i][5];?>&cat3=<?php echo $SoloArrcateg[$i][6];?>&tecnico=<?php echo $SoloArrcateg[$i][1];?>&opc1=4&secuencia=<?php echo $SoloArrcateg[$i][0];?>&medida=<?php echo $SoloArrcateg[$i][9];?>&cantidad=<?php echo $SoloArrcateg[$i][10];?>',200,200,600,350);"><img src="iconos/soloico_modificar.gif" alt="Modificar" border="0"></a>-->
                    &nbsp;<a href="javascript:SoloFun_Windows('solotrn_asociar_tecnico_categoria.php?CboEmpresa=<?php echo $SoloArrcateg[$i][2];?>&CboArea=<?php echo $SoloArrcateg[$i][3];?>&CboCategoria1=<?php echo $SoloArrcateg[$i][4];?>&CboCategoria2=<?php echo $SoloArrcateg[$i][5];?>&CboCategoria3=<?php echo $SoloArrcateg[$i][6];?>&CboSoporte=<?php echo $SoloArrcateg[$i][1];?>&opc1=4&secuencia=<?php echo $SoloArrcateg[$i][0];?>&Cbomedida=<?php echo $SoloArrcateg[$i][9];?>&txtcanti=<?php echo $SoloArrcateg[$i][10];?>',200,200,600,350);"><img src="iconos/soloico_modificar.gif" alt="Modificar" border="0"></a>
                    &nbsp;&nbsp; <a href="javascript:SoloFun_Confirm('solotrn_grabaasociatec.php?opc1=2&secuencia=<?php echo $SoloArrcateg[$i][0];?>','Esta seguro que desea desasociar la categoria?');"><img src="iconos/soloico_eliminar.gif" alt="Eliminar" border="0"></a>	</td>
            </tr>
        <?php  }?>
        </table>
    <?php }else {?>
        <table width="90%" border="1" cellpadding="0" cellspacing="1" align="center" bordercolor="#CCCCCC">
            <tr class="SoloStyle_Etiqueta">
                <td width="10%" height="20">Secuencia</td>
                <td width="15%">Grupo de servicio </td>
                <td width="15%">Departamento</td>
                <td width="15%">Categor&iacute;a1</td>
                <td width="15%">Categor&iacute;a2</td>
                <td width="15%">Categor&iacute;a3</td>
                <td width="5%">Tiempo de expiraci&oacute;n</td>
                <td width="10%">Acci&oacute;n</td>
            </tr>
                <?php
//		'CL_FILAS=-1
//		'CL_FILAS=ubound(arrUsuario,2)
//   'IF CL_FILAS>=0 THEN
    $cantidad = 0;
    for ($i = 0; $i < count($SoloArrcateg); $i++) {
        $clase = "SoloStyle_texto";
        if ($i%2 == 0) $clase = "SoloStyle_Grid";?>
            <tr class="<?php echo $clase;?>">
                <td width="10%"><?php echo $SoloArrcateg[$i][0];?></td>
                <td width="15%"><?php echo $nivel1[$i];?></td>
                <td width="15%"><?php echo $nivel2[$i];?></td>
                <td width="15%"><?php echo $nivel3[$i];?></td>
                <td width="15%"><?php echo $nivel4[$i];?> </td>
                <td width="15%"><?php echo $nivel5[$i];?> </td>
                        <?php
                        if ($SoloArrcateg[$i][9] == 63 && $SoloArrcateg[$i][10] == 1)
                            $tiempo = "D&iacute;a";
                        elseif ($SoloArrcateg[$i][9] == 63 && $SoloArrcateg[$i][10] > 1)
                            $tiempo = "D&iacute;as";
                        elseif ($SoloArrcateg[$i][9] == 64 && $SoloArrcateg[$i][10] = 1)
                            $tiempo = "Hora";
                        elseif ($SoloArrcateg[$i][9] == 64 && $SoloArrcateg[$i][10] > 1)
                            $tiempo = "Horas";
                        elseif ($SoloArrcateg[$i][9] == 65 && $SoloArrcateg[$i][10] == 1)
                            $tiempo = "Minuto";
                        elseif ($SoloArrcateg[$i][9] == 65 && $SoloArrcateg[$i][10] > 1)
                            $tiempo = "Minutos";
                        /*end if
	end if
	end if
	end if
	end if
	end if*/


        ?>
                <td width="5%"><?php echo $SoloArrcateg[$i][10];?>&nbsp;<?php echo $tiempo;?></td>
                <td width="10%">
                    &nbsp;<a href="javascript:SoloFun_Windows('solotrn_asociar_tecnico_categoria.php?empresa=<?php echo $SoloArrcateg[$i][2];?>&departamento=<?php echo $SoloArrcateg[$i][3];?>&cat1=<?php echo $SoloArrcateg[$i][4];?>&cat2=<?php echo $SoloArrcateg[$i][5];?>&cat3=<?php echo $SoloArrcateg[$i][6];?>&tecnico=<?php echo $CboSoporte;?>&opc1=4&secuencia=<?php echo $SoloArrcateg[$i][0];?>&medida=<?php echo $SoloArrcateg[$i][9];?>&cantidad=<?php echo $SoloArrcateg[$i][10];?>',200,200,600,250);"><img src="iconos/soloico_modificar.gif" alt="Modificar" border="0"></a>
                    &nbsp;&nbsp; <a href="javascript:SoloFun_Confirm('solotrn_grabaasociatec.php?opc1=2&secuencia=<?php echo $SoloArrcateg[$i][0];?>','Esta seguro que desea desasociar la categoria?');"><img src="iconos/soloico_eliminar.gif" alt="Eliminar" border="0"></a>	</td>
            </tr>
        <?php  }?>
        </table>

    <?php }?>

        <br>
    </body>
</html>
<?php
include "Includes/soloFun_ShowMessages.php";
?>
